home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 776 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.3 KB

  1. Path: EU.net!sun4nl!xs4all!usenet
  2. From: martijnl@xs4all.nl (Martijn Lievaart)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Variable Problems
  5. Date: 7 Jan 1996 01:14:13 GMT
  6. Organization: XS4ALL, networking for the masses
  7. Message-ID: <4cn6p5$he7@news.xs4all.nl>
  8. References: <820864676snz@seacloud.demon.co.uk>
  9. NNTP-Posting-Host: mas01-09.dial.xs4all.nl
  10. X-Newsreader: WinVN 0.99.6
  11.  
  12. In article <820864676snz@seacloud.demon.co.uk>, Ben@seacloud.demon.co.uk 
  13. says...
  14. >
  15. >Hi,
  16. >
  17. >I am very new to C++, and for my first project I decided to develop and 
  18. MS-DOS
  19. >game.  A friend recommended MSVC, and so I purchased that.  I have got the
  20. >hang of classes and such like, and the GUI for the game is going very well 
  21. and
  22. >it even has mouse support.
  23. >
  24. >The only problem Im having, is that some variables seem to be getting over
  25. >written during execution, without me saying so.  Using Codeview, I have
  26. >determined that this is happening after excessive class calls (ie, a line of
  27. >code is accessing several classes within classes many times).  The variables
  28. >that are getting over written are members of the same parent class as the
  29. >classes which seem to be killing them.  Judging by the new value of the
  30. >variable I don't want to be changed at that point, I think the value may be
  31. >coming from a member of the aforementioned class calls.
  32. >
  33. >I have checked the code throughly, and found, as I suspected, that I have 
  34. only
  35. >set these variables once (in a constructor), and not again afterwards.  I was
  36. >wondering if anybody out there knew why this was happening, and if there were
  37. >any more checks or a solution I could use to stop it happening.
  38. >
  39. >Sorry if its obvious.  if anyone needs to look at the class definitions, I 
  40. can
  41. >post (or Email) them.
  42. >
  43. >Hope somebody can help!
  44. >
  45. >-- 
  46. >Cheers,
  47. >
  48. >Ben
  49. >
  50.  
  51. I wouldn't say this is obvious. When something like this occurs to me, it's 
  52. time for tracepoints. You now, those breakpoints that break when a variable 
  53. changes. Often difficult to get to work correctly, but beleave me, well worth 
  54. the effort.
  55.  
  56. I don't know VC, but I would think it supports tracepoints. BC even does them 
  57. in hardware (386 and up support this in the processor!), makes them about 1000 
  58. times faster. Without hardware support, your program slows to a crawl. Hmm, 
  59. time for coffee.
  60.  
  61. Hope this helps,
  62. Martijn
  63.  
  64.